package org.goyo.main.web.controller.report;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import net.sf.json.JSONObject;

import org.goyo.main.domain.dao.report.ISysReport;
import org.goyo.main.domain.entity.report.InventoryReport;
import org.goyo.main.web.controller.BaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * 报表类
 * @author chenchuan
 * 2014年11月12日
 */
@Controller
@RequestMapping("/sysReport")
public class SysReportController extends BaseController  {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
	@Resource
	ISysReport sysReport;
	/**
	 * 库存台账表
	 * 
	 * @author chenchuan
	 * 2014年11月9日
	 */
	@RequestMapping("/toInventoryReportList")
	public String toPurOrderList(Model model){
		return "/report/InventoryReportList";
	}
	
	/**
	 * list列表数据加载
	 * 
	 * @author chenchuan
	 * 2014年11月9日
	 */
	@RequestMapping("/listInventoryReportData")
	@ResponseBody
	public String ListData(HttpServletRequest request){
		JSONObject data = null;
		try {
			List<InventoryReport> reports = sysReport.getAll(InventoryReport.class);
			Map<String,Object> map = new HashMap<String,Object>();
			map.put("Rows", reports);
			map.put("Total",100000);
			data = JSONObject.fromObject(map);
		}catch (Exception e) {
			logger.error(e.getMessage(),e);
		} 
		return data.toString();
	}
	
}
